package lk.icta.core.entity;

import lk.icta.common.entity.*;

import javax.persistence.*;
import java.util.Date;
import java.util.List;

@Entity
@Table(schema = "ELAND_RAIL")
@NamedQueries({
        @NamedQuery(
                name = "getLandByName",
                query = "SELECT l FROM Land l WHERE l.nameOfTheLand = :nameOfTheLand"
        ),
        @NamedQuery(
                name = "getLandsByGNDivision",
                query = "SELECT l FROM Land l WHERE l.gnDivision.id = :gnDivisionId"
        ),
        @NamedQuery(
                name = "getActiveLandsByGNDivision",
                query = "SELECT l FROM Land l WHERE l.gnDivision.id = :gnDivisionId AND l.alienationState <> 2"
        ),
        @NamedQuery(
                name = "getActivePendingLandsByGNDivision",
                query = "SELECT l FROM Land l WHERE l.gnDivision.id = :gnDivisionId AND " +
                        "l.alienationState <> 2 AND l.approvalState = 2 AND l.mode =1 ORDER BY l.lifeCycleInfo.lastUpdatedTimeStamp ASC"
        ),
        @NamedQuery(
                name = "getRejectedLandsByGNDivision",
                query = "SELECT l FROM Land l WHERE l.gnDivision.id = :gnDivisionId AND " +
                        "l.alienationState <> 2 AND l.approvalState = 0 AND l.mode =1 ORDER BY l.lifeCycleInfo.lastUpdatedTimeStamp ASC"
        ),
        @NamedQuery(
                name = "getSubDividedLandsTobeApproveByGNDivision",
                query = "SELECT l FROM Land l WHERE l.gnDivision.id = :gnDivisionId AND " +
                        "l.alienationState <> 2 AND l.approvalState = 2 AND l.mode =2"
        ),
        @NamedQuery(
                name = "getSubDividedLandsTobeEditByGNDivision",
                query = "SELECT l FROM Land l WHERE l.gnDivision.id = :gnDivisionId AND " +
                        "l.alienationState <> 2 AND l.approvalState <> 1 AND l.approvalState <> 3 AND l.mode =2"
        ),
        @NamedQuery(
                name = "getActivePendingLandsByDSDivision",
                query = "SELECT l FROM Land l WHERE l.gnDivision.dsDivision.id = :dsDivisionId AND " +
                        "l.alienationState <> 2 AND l.approvalState = 2 AND l.mode =1 ORDER BY l.lifeCycleInfo.lastUpdatedTimeStamp ASC"
        ),
        @NamedQuery(
                name = "getRejectedLandsByDSDivision",
                query = "SELECT l FROM Land l WHERE l.gnDivision.dsDivision.id = :dsDivisionId AND " +
                        "l.alienationState <> 2 AND l.approvalState = 0 AND l.mode =1 ORDER BY l.lifeCycleInfo.lastUpdatedTimeStamp ASC"
        ),
        @NamedQuery(
                name = "getSubDividedLandsTobeApproveByDSDivision",
                query = "SELECT l FROM Land l WHERE l.gnDivision.dsDivision.id = :dsDivisionId AND " +
                        "l.alienationState <> 2 AND l.approvalState = 2 AND l.mode =2"
        ),
        @NamedQuery(
                name = "getSubDividedLandsTobeEditByDSDivision",
                query = "SELECT l FROM Land l WHERE l.gnDivision.dsDivision.id = :dsDivisionId AND " +
                        "l.alienationState <> 2 AND l.approvalState <> 1 AND l.approvalState <> 3 AND l.mode =2"
        ),
        @NamedQuery(
                name = "getAllActivePendingLands",
                query = "SELECT l FROM Land l WHERE l.alienationState <> 2 AND l.approvalState = 2 " +
                        "AND l.gnDivision.dsDivision.id = :dsDivisionId"
        ),
        @NamedQuery(
                name = "getLandsByDivisionListAndStateAndMode",
                query = "SELECT l FROM Land l WHERE l.gnDivision.dsDivision in (:dsDivisionList) " +
                        "AND l.alienationState <> 2 AND l.approvalState = :state AND l.mode = :mode"
        ),
        @NamedQuery(
                name = "getLandsByDSDivision",
                query = "SELECT l FROM Land l WHERE l.gnDivision.dsDivision.id = :dsDivisionId"
        ),
        @NamedQuery(
                name = "getActiveLandsByDSDivision",
                query = "SELECT l FROM Land l WHERE l.gnDivision.dsDivision.id = :dsDivisionId AND " +
                        "l.alienationState <> 2"
        ),
        @NamedQuery(
                name = "getLandsByDistrict",
                query = "SELECT l FROM Land l WHERE l.gnDivision.dsDivision.district.id = :districtId"
        ),
        @NamedQuery(
                        name = "getLandsByDistrictRail",
                        query = "SELECT l FROM Land l WHERE l.district.id = :districtId"
        ),
        @NamedQuery(
                name = "getActiveLandsByDistrict",
                query = "SELECT l FROM Land l WHERE l.gnDivision.dsDivision.district.id = :districtId " +
                        "AND l.alienationState <> 2"
        ),
        @NamedQuery(
                name = "getLandsByProvince",
                query = "SELECT l FROM Land l WHERE l.gnDivision.dsDivision.district.province.id = :provinceId"
        ),
        @NamedQuery(
                name = "getLandByPlanNo",
                query = "SELECT l FROM Land l WHERE l.planNumber = :planNo"
        ),
        @NamedQuery(
                name = "getInitialActiveLandsByGNDivision",
                query = "SELECT l FROM Land l WHERE l.gnDivision.id = :gnDivisionId AND l.initialRecordId = 0 " +
                        "AND l.alienationState <> 2 AND l.mode = 1 "
        ),
        @NamedQuery(
                name = "getInitialActiveLandsByDSDivision",
                query = "SELECT l FROM Land l WHERE l.initialRecordId = 0 AND l.alienationState <> 2 AND l.mode = 1 " +
                        "AND l.gnDivision.dsDivision.id = :dsDivisionId"
        ),
        @NamedQuery(
                name = "getUnalienatedLandList",
                query = "SELECT l FROM Land l WHERE l.alienationState = 0 AND l.mode = 1 AND l.approvalState = 1 "
        ),
        @NamedQuery(
                name = "getDetailActiveLandsByGNDivision",
                query = "SELECT l FROM Land l WHERE l.gnDivision.id = :gnDivisionId AND l.initialRecordId > 0 " +
                        "AND l.approvalState <> 2 AND l.approvalState <> 1 AND l.alienationState <> 2 AND l.mode = 1"
        ),
        @NamedQuery(
                name = "getIncompleteDetailLandsByGNDivision",
                query = "SELECT l FROM Land l WHERE l.gnDivision.id = :gnDivisionId AND l.initialRecordId >= 0 " +
                        "AND l.approvalState <> 2 AND l.approvalState <> 1 AND l.alienationState <> 2 AND l.mode = 1"
        ),
        @NamedQuery(
                name = "getAllIncompleteDetailLands",
                query = "SELECT l FROM Land l WHERE l.initialRecordId >= 0 AND l.approvalState <> 2 " +
                        "AND l.approvalState <> 1 AND l.alienationState <> 2 AND l.mode = 1 " +
                        "AND l.gnDivision.dsDivision.id = :dsDivisionId"
        ),
        @NamedQuery(
                name = "getApprovedUnAlienatedLandsByGNDivision",
                query = "SELECT l FROM Land l WHERE l.gnDivision.id = :gnDivisionId AND l.approvalState = 1 " +
                        "AND l.alienationState <> 2 AND NOT EXISTS (SELECT a FROM Alienation a WHERE l.id = a.land.id)"
        ),
        @NamedQuery(
                name = "getApprovedUnAlienatedLandById",
                query = "SELECT l FROM Land l WHERE l.id = :id AND l.approvalState = 1 " +
                        "AND l.alienationState <> 2 AND NOT EXISTS (SELECT a FROM Alienation a WHERE l.id = a.land.id)"
        ),
        @NamedQuery(
                name = "getAllApprovedUnAlienatedLands",
                query = "SELECT l FROM Land l WHERE l.gnDivision.dsDivision.id = :dsDivisionId AND l.approvalState = 1 AND l.alienationState <> 2 " +
                        "AND NOT EXISTS (SELECT a FROM Alienation a WHERE l.id = a.land.id)"

        ),
        @NamedQuery(
                name = "getApprovedLandsByGNDivision",
                query = "SELECT l FROM Land l WHERE l.gnDivision.id = :gnDivisionId AND " +
                        "l.approvalState = 1 AND l.alienationState <> 2"
        ),
        @NamedQuery(
                name = "getAllApprovedLandsByUser",
                query = "SELECT l FROM Land l WHERE l.gnDivision.dsDivision.id = :dsDivisionId AND " +
                        "l.approvalState = 1 AND l.alienationState <> 2"
        ),
        @NamedQuery(
                name = "getDetailLandsReportByGNDivision",
                query = "SELECT l FROM Land l WHERE l.gnDivision.id = :gnDivisionId AND l.initialRecordId >= 0   " +
                        "AND l.alienationState <> 2 AND l.mode = 1"
        ),
        @NamedQuery(
                name = "isExistAlienation",
                query = "SELECT a FROM Alienation a WHERE a.land.id = :landId AND a.status = 1"
        ),
        @NamedQuery(
                name = "searchActiveLandsByLandName",
                query = "SELECT l FROM Land l WHERE l.alienationState <> 2 AND l.approvalState = 1 " +
                        "AND l.nameOfTheLand LIKE :landName"
        ),
        @NamedQuery(
                name = "searchActiveLandsByPlanNo",
                query = "SELECT l FROM Land l WHERE l.alienationState <> 2 AND l.approvalState = 1 " +
                        "AND l.planNumber LIKE :planNo"
        ),
        @NamedQuery(
                name = "searchActiveLandsByLotNo",
                query = "SELECT l FROM Land l WHERE l.alienationState <> 2 AND l.approvalState = 1 " +
                        "AND l.lotNumber LIKE :lotNo"
        ),
        @NamedQuery(
                name = "searchActiveLandsByHolderName",
                query = "SELECT l FROM Land l WHERE l.alienationState <> 2 AND l.approvalState = 1 AND EXISTS " +
                        "(SELECT a FROM Alienation a WHERE l.id = a.land.id AND a.holder.name LIKE :holderName) "
        ),
        @NamedQuery(
                name = "searchAllActiveApprovedLands",
                query = "SELECT l FROM Land l WHERE l.alienationState <> 2 AND l.approvalState = 1"
        ),
        @NamedQuery(
                name = "searchActiveLandsOfDSDivisionIDByLandName",
                query = "SELECT l FROM Land l WHERE " +
                        "l.alienationState <> 2 AND l.approvalState = 1  AND l.nameOfTheLand LIKE :landName AND l.gnDivision.dsDivision.id = :dsDivisionId "
        ),
        @NamedQuery(
                name = "searchActiveLandsOfDSDivisionByLandName",
                query = "SELECT l FROM Land l WHERE " +
                        "(1 = :ignoreDS AND l.alienationState <> 2 AND l.approvalState = 1  AND l.nameOfTheLand LIKE :landName) OR " +
                        "(0 = :ignoreDS AND l.alienationState <> 2 AND l.approvalState = 1  AND l.nameOfTheLand LIKE :landName AND l.gnDivision.dsDivision IN (:DSList))"
        ),
        @NamedQuery(
                name = "searchActiveLandsOfDSDivisionByPlanNo",
                query = "SELECT l FROM Land l WHERE " +
                        "(1 = :ignoreDS AND l.alienationState <> 2 AND l.approvalState = 1  AND l.planNumber LIKE :planNo) OR " +
                        "(0 = :ignoreDS AND l.alienationState <> 2 AND l.approvalState = 1  AND l.planNumber LIKE :planNo AND l.gnDivision.dsDivision IN (:DSList))"


        ),
        @NamedQuery(
                name = "searchActiveLandsOfDSDivisionByLotNo",
                query = "SELECT l FROM Land l WHERE " +
                        "(1 = :ignoreDS AND l.alienationState <> 2 AND l.approvalState = 1  AND l.lotNumber LIKE :lotNo) OR " +
                        "(0 = :ignoreDS AND l.alienationState <> 2 AND l.approvalState = 1  AND l.lotNumber LIKE :lotNo AND l.gnDivision.dsDivision IN (:DSList))"
        ),
        @NamedQuery(
                name = "searchActiveLandsOfDSDivisionByHolderName",
                query = "SELECT l FROM Land l WHERE " +
                        "(1 = :ignoreDS AND l.alienationState <> 2 AND l.approvalState = 1 " +
                        " AND EXISTS (SELECT a FROM Alienation a " +
                        "WHERE l.id = a.land.id AND a.holder.name LIKE :holderName) ) OR " +
                        "(0 = :ignoreDS AND l.alienationState <> 2 AND l.approvalState = 1 " +
                        " AND EXISTS (SELECT a FROM Alienation a " +
                        " WHERE l.id = a.land.id AND a.holder.name LIKE :holderName) AND l.gnDivision.dsDivision IN (:DSList))"
        ),

        @NamedQuery(
                name = "searchAllActiveApprovedLandsOfDSDivision",
                query = "SELECT l FROM Land l WHERE l.alienationState <> 2 " +
                        "AND l.gnDivision.dsDivision.id = :dsDivisionId " +
                        "AND l.approvalState = 1 ORDER BY l.id"
        ),
        @NamedQuery(
                name = "searchAllActiveApprovedLandsOfDistrict",
                query = "SELECT l FROM Land l WHERE l.alienationState <> 2 " +
                        "AND l.gnDivision.dsDivision.district.id = :districtId " +
                        "AND l.approvalState = 1 ORDER BY l.id"
        ),


        @NamedQuery(
                name = "deleteLandById",
                query = "DELETE  FROM Land l WHERE l.id = :landId"
        ),
        @NamedQuery(
                name = "getAllActivePendingIncompleteLands",
                query = "SELECT l FROM Land l WHERE l.initialRecordId >= 0 " +
                        "AND l.approvalState <> 1 AND l.alienationState <> 2 AND l.mode = 1 " +
                        "AND l.gnDivision.dsDivision.id = :dsDivisionId ORDER BY l.lifeCycleInfo.lastUpdatedTimeStamp ASC"
        ),
        @NamedQuery(
                name = "getAllActivePendingIncompleteLandsByGNDivision",
                query = "SELECT l FROM Land l WHERE l.initialRecordId >= 0 " +
                        "AND l.approvalState <> 1 AND l.alienationState <> 2 AND l.mode = 1 " +
                        "AND l.gnDivision.id = :gnDivisionId ORDER BY l.lifeCycleInfo.lastUpdatedTimeStamp ASC"
        ),
        @NamedQuery(
                name = "searchAllActiveApprovedUnalienatedLandsOfDSDivision",
                query = "SELECT l FROM Land l WHERE l.alienationState <> 2 " +
                        "AND l.gnDivision.dsDivision.id = :dsDivisionId " +
                        "AND l.approvalState = 1 AND NOT EXISTS (SELECT a FROM Alienation a WHERE l.id = a.land.id) ORDER BY l.id"
        ),
        @NamedQuery(
                name = "searchAllLandsOfDSDivision",
                query = "SELECT l FROM Land l WHERE l.alienationState <> 2 " +
                        "AND l.gnDivision.dsDivision.id = :dsDivisionId " +
                        "ORDER BY l.id"

        ),
        @NamedQuery(
                name = "searchAllLandsOfDistrict",
                query = "SELECT l FROM Land l WHERE l.alienationState <> 2 " +
                        "AND l.gnDivision.dsDivision.district.id = :districtId " +
                        "ORDER BY l.id"

        ),
        @NamedQuery(
                name = "searchAllLandsOfDSDivisionByLandNameByMigrateData",
                query = "SELECT l FROM Land l WHERE " +
                        "(1 = :ignoreDS AND 1 = :migrateData AND l.alienationState <> 2  AND l.nameOfTheLand LIKE :landName) AND l.lifeCycleInfo.createdUser.username = 'admin' OR " +
                        "(1 = :ignoreDS AND 0 = :migrateData AND l.alienationState <> 2  AND l.nameOfTheLand LIKE :landName) AND l.lifeCycleInfo.createdUser.username <> 'admin'  OR " +
                        "(0 = :ignoreDS AND 1 = :migrateData AND l.alienationState <> 2  AND l.nameOfTheLand LIKE :landName AND l.gnDivision.dsDivision IN (:DSList)) AND l.lifeCycleInfo.createdUser.username = 'admin' OR" +
                        "(0 = :ignoreDS AND 0 = :migrateData AND  l.alienationState <> 2  AND l.nameOfTheLand LIKE :landName AND l.lifeCycleInfo.createdUser.username <> 'admin' AND l.gnDivision.dsDivision IN (:DSList))"
        ),
        @NamedQuery(
                name = "searchAllLandsOfManyDSDivisionsOfUpperLevel",
                query = "SELECT l FROM Land l WHERE " +
                        "(1 = :ignoreDS AND l.alienationState <> 2  ) OR " +
                        "(0 = :ignoreDS AND l.alienationState <> 2  AND l.gnDivision.dsDivision IN (:DSList))" +
                        " ORDER BY l.id"

        )


})
public class Land extends BaseEntity {

    public enum AlienationState {
        UNALIENATED,    // 0 - state. Available for alienation
        ALIENATED,      // 1 - state. Not available for alienation
        ARCHIVED        // 2 - state. Archived and can not be edited nor available for alienation
    }

    public enum ApprovalState {
        REJECTED,   // 0 - state. Not available for alienation
        APPROVED,   // 1 - state. Available for alienation
        PENDING,    // 2 - state. Pending for approval and available for alienation
        DATA_ENTRY  // 3 - state. Land is in data entry state.
    }

    public enum Mode {
        INITIAL,    // 0 - state. Initial mode
        DETAIL,      // 1 - state. Detail mode
        SUBDIVIDED      // 2 - state. SubDivided mode
    }

    //todo: add aLIENATIONiD

    @ManyToOne
    @JoinColumn(nullable = false)
    private District district;

    @ManyToOne
    @JoinColumn(nullable = false)
    private RailwayTrack railwayTrack;

    @ManyToOne
    @JoinColumn(nullable = false)
    private DistrictEngineerZone districtEngineerZone;

    @ManyToOne
    @JoinColumn(nullable = false)
    private IPWZone ipwZone;

    @ManyToOne
    @JoinColumn
    private RailwayProtectionZone railwayProtectionZone;

    @ManyToOne
    @JoinColumn
    private RailwayStation nearestRailwayStation;

    @ManyToOne
    @JoinColumn
    private LandLocation landLocation;

    @ManyToOne
    @JoinColumn(nullable = true)
    private LocalAuthority localAuthority;

    @ManyToOne
    @JoinColumn(name = "geologicalType", nullable = true)
    private GeologicalType geologicalType;

    @Column(nullable = false)
    private String nameOfTheLand;

    @Column(nullable = false)
    private boolean isActive;

    @Column(nullable = true)
    private String village;

    @Column(nullable = true)
    private String planNumber;

    @Column(nullable = true)
    private String lotNumber;

    @Column(nullable = true)
    private String surveyor;

    @Column(nullable = true)
    @Temporal(value = TemporalType.DATE)
    private Date planDate;

    @Column(nullable = true)
    private double landExtent;

    @Column(nullable = true)
    private String northBoundary;

    @Column(nullable = true)
    private String northEastBoundary;

    @Column(nullable = true)
    private String eastBoundary;

    @Column(nullable = true)
    private String southEastBoundary;

    @Column(nullable = true)
    private String southBoundary;

    @Column(nullable = true)
    private String southWestBoundary;

    @Column(nullable = true)
    private String westBoundary;

    @Column(nullable = true)
    private String northWestBoundary;

    @ManyToOne
    @JoinColumn(name = "northBoundaryType", nullable = true)
    private BoundaryType northBoundaryType;

    @ManyToOne
    @JoinColumn(name = "northEastBoundaryType", nullable = true)
    private BoundaryType northEastBoundaryType;

    @ManyToOne
    @JoinColumn(name = "eastBoundaryType", nullable = true)
    private BoundaryType eastBoundaryType;

    @ManyToOne
    @JoinColumn(name = "southEastBoundaryType", nullable = true)
    private BoundaryType southEastBoundaryType;

    @ManyToOne
    @JoinColumn(name = "southBoundaryType", nullable = true)
    private BoundaryType southBoundaryType;

    @ManyToOne
    @JoinColumn(name = "southWestBoundaryType", nullable = true)
    private BoundaryType southWestBoundaryType;

    @ManyToOne
    @JoinColumn(name = "westBoundaryType", nullable = true)
    private BoundaryType westBoundaryType;

    @ManyToOne
    @JoinColumn(name = "northWestBoundaryType", nullable = true)
    private BoundaryType northWestBoundaryType;

    @Column(nullable = false)
    private AlienationState alienationState;

    @Column(nullable = false)
    private ApprovalState approvalState;



//    @ManyToOne(fetch = FetchType.EAGER, cascade = {CascadeType.REFRESH})
//    @JoinColumn
//    private Land parentLand;

//    @Column(nullable = false)
//    private long initialRecordId;

    @Column(nullable = true, columnDefinition = "text")
    private String approvalNote;

    @Column(nullable = true, columnDefinition = "text")
    private String landVisitComment;

    @Transient
    private List<Document> documentList;

//    //this is always State - for unalianated lands
//    @Column(nullable = true)
//    private String landHolder;

//    @OneToMany(cascade = CascadeType.ALL)
//    @JoinTable(schema = "ELAND_RAIL")
//    private List<Occupier> occupiers;

//    @Column(nullable = true)
//    private Double minimumSubDivisionUnit;

//    @Column(nullable = true)
//    private Double minimumFraction;

//    @Column(nullable = true)
//    private long referenceNumber;

    @Column(nullable = true)
    private Double kmlLandArea;

    @Column(columnDefinition = "text")
    private String kmlString;

    @Column(nullable = true)
    private String kmlMiddlePoint;

//    @Column(nullable = true)
//    private String areaInWord;

    /**
     * The preferred language
     */
//    @Column(length = 2, nullable = false)
//    private String prefLanguage;

//    @OneToOne(cascade = {CascadeType.ALL})
//    @JoinColumn
//    private GeoParcelCode geoParcelCode;



    @Transient
    private boolean migratedRecord;

    @Embedded
    private LifeCycleInfo lifeCycleInfo = new LifeCycleInfo();

    //remove
    @ManyToOne
        @JoinColumn(nullable = true)
        private GNDivision gnDivision;

    @Column(nullable = true)
       private long initialRecordId;

    @Column(nullable = true)
    private Mode mode;

    public LocalAuthority getLocalAuthority() {
        return localAuthority;
    }

    public void setLocalAuthority(LocalAuthority localAuthority) {
        this.localAuthority = localAuthority;
    }

    public String getNameOfTheLand() {
        return nameOfTheLand;
    }

    public void setNameOfTheLand(String nameOfTheLand) {
        this.nameOfTheLand = nameOfTheLand;
    }

    public String getVillage() {
        return village;
    }

    public void setVillage(String village) {
        this.village = village;
    }

    public String getPlanNumber() {
        return planNumber;
    }

    public void setPlanNumber(String planNumber) {
        this.planNumber = planNumber;
    }

    public String getLotNumber() {
        return lotNumber;
    }

    public void setLotNumber(String lotNumber) {
        this.lotNumber = lotNumber;
    }

    public double getLandExtent() {
        return landExtent;
    }

    public void setLandExtent(double landExtent) {
        this.landExtent = landExtent;
    }

    public GeologicalType getGeologicalType() {
        return geologicalType;
    }

    public void setGeologicalType(GeologicalType geologicalType) {
        this.geologicalType = geologicalType;
    }

    /*public long getInitialRecordId() {
        return initialRecordId;
    }

    public void setInitialRecordId(long initialRecordId) {
        this.initialRecordId = initialRecordId;
    }
      */
    public Mode getMode() {
        return mode;
    }

    public void setMode(Mode mode) {
        this.mode = mode;
    }

    public AlienationState getAlienationState() {
        return alienationState;
    }

    public void setAlienationState(AlienationState alienationState) {
        this.alienationState = alienationState;
    }

    public ApprovalState getApprovalState() {
        return approvalState;
    }

    public void setApprovalState(ApprovalState approvalState) {
        this.approvalState = approvalState;
    }

    public String getApprovalNote() {
        return approvalNote;
    }

    public void setApprovalNote(String approvalNote) {
        this.approvalNote = approvalNote;
    }

    public List<Document> getDocumentList() {
        return documentList;
    }

    public void setDocumentList(List<Document> documentList) {
        this.documentList = documentList;
    }

    public LifeCycleInfo getLifeCycleInfo() {
        return lifeCycleInfo;
    }

    public void setLifeCycleInfo(LifeCycleInfo lifeCycleInfo) {
        this.lifeCycleInfo = lifeCycleInfo;
    }

    public String getSurveyor() {
        return surveyor;
    }

    public void setSurveyor(String surveyor) {
        this.surveyor = surveyor;
    }

    public Date getPlanDate() {
        return planDate;
    }

    public void setPlanDate(Date planDate) {
        this.planDate = planDate;
    }

    public String getLandVisitComment() {
        return landVisitComment;
    }

    public void setLandVisitComment(String landVisitComment) {
        this.landVisitComment = landVisitComment;
    }

    /*public String getLandHolder() {
        return landHolder;
    }

    public void setLandHolder(String landHolder) {
        this.landHolder = landHolder;
    }*/

  /*  public List<Occupier> getOccupiers() {
        return occupiers;
    }

    public void setOccupiers(List<Occupier> occupiers) {
        if (occupiers != null) {
            List<Occupier> occupierList = new ArrayList<Occupier>();
            for (Occupier o : occupiers) {
                if (o != null && o.getName() != null && !o.getName().isEmpty()) {
                    occupierList.add(o);
                }
            }
            this.occupiers = occupierList;
        }
    }
*/

//    public List<Occupier> getOccupiers() {
//        return occupiers;
//    }
//
//    public void setOccupiers(List<Occupier> occupiers) {
//        this.occupiers = occupiers;
//    }

    public BoundaryType getNorthBoundaryType() {
        return northBoundaryType;
    }

    public void setNorthBoundaryType(BoundaryType northBoundaryType) {
        this.northBoundaryType = northBoundaryType;
    }

    public BoundaryType getNorthEastBoundaryType() {
        return northEastBoundaryType;
    }

    public void setNorthEastBoundaryType(BoundaryType northEastBoundaryType) {
        this.northEastBoundaryType = northEastBoundaryType;
    }

    public BoundaryType getEastBoundaryType() {
        return eastBoundaryType;
    }

    public void setEastBoundaryType(BoundaryType eastBoundaryType) {
        this.eastBoundaryType = eastBoundaryType;
    }

    public BoundaryType getSouthEastBoundaryType() {
        return southEastBoundaryType;
    }

    public void setSouthEastBoundaryType(BoundaryType southEastBoundaryType) {
        this.southEastBoundaryType = southEastBoundaryType;
    }

    public BoundaryType getSouthBoundaryType() {
        return southBoundaryType;
    }

    public void setSouthBoundaryType(BoundaryType southBoundaryType) {
        this.southBoundaryType = southBoundaryType;
    }

    public BoundaryType getSouthWestBoundaryType() {
        return southWestBoundaryType;
    }

    public void setSouthWestBoundaryType(BoundaryType southWestBoundaryType) {
        this.southWestBoundaryType = southWestBoundaryType;
    }

    public BoundaryType getWestBoundaryType() {
        return westBoundaryType;
    }

    public void setWestBoundaryType(BoundaryType westBoundaryType) {
        this.westBoundaryType = westBoundaryType;
    }

    public BoundaryType getNorthWestBoundaryType() {
        return northWestBoundaryType;
    }

    public void setNorthWestBoundaryType(BoundaryType northWestBoundaryType) {
        this.northWestBoundaryType = northWestBoundaryType;
    }

//    public Double getMinimumSubDivisionUnit() {
//        return minimumSubDivisionUnit;
//    }
//
//    public void setMinimumSubDivisionUnit(Double minimumSubDivisionUnit) {
//        this.minimumSubDivisionUnit = minimumSubDivisionUnit;
//    }
//
//    public Double getMinimumFraction() {
//        return minimumFraction;
//    }
//
//    public void setMinimumFraction(Double minimumFraction) {
//        this.minimumFraction = minimumFraction;
//    }
//
//    public long getReferenceNumber() {
//        return referenceNumber;
//    }
//
//    public void setReferenceNumber(long referenceNumber) {
//        this.referenceNumber = referenceNumber;
//    }

    public Double getKmlLandArea() {
        return kmlLandArea;
    }

    public void setKmlLandArea(Double kmlLandArea) {
        this.kmlLandArea = kmlLandArea;
    }

//    public Land getParentLand() {
//        return parentLand;
//    }
//
//    public void setParentLand(Land parentLand) {
//        this.parentLand = parentLand;
//    }

    public boolean isActive() {
        return isActive;
    }

    public void setActive(boolean active) {
        isActive = active;
    }

    public String getKmlString() {
        return kmlString;
    }

    public void setKmlString(String kmlString) {
        this.kmlString = kmlString;
    }

    public String getKmlMiddlePoint() {
        return kmlMiddlePoint;
    }

    public void setKmlMiddlePoint(String kmlMiddlePoint) {
        this.kmlMiddlePoint = kmlMiddlePoint;
    }

    public String getNorthBoundary() {
        return northBoundary;
    }

    public void setNorthBoundary(String northBoundary) {
        this.northBoundary = northBoundary;
    }

    public String getNorthEastBoundary() {
        return northEastBoundary;
    }

    public void setNorthEastBoundary(String northEastBoundary) {
        this.northEastBoundary = northEastBoundary;
    }

    public String getEastBoundary() {
        return eastBoundary;
    }

    public void setEastBoundary(String eastBoundary) {
        this.eastBoundary = eastBoundary;
    }

    public String getSouthEastBoundary() {
        return southEastBoundary;
    }

    public void setSouthEastBoundary(String southEastBoundary) {
        this.southEastBoundary = southEastBoundary;
    }

    public String getSouthBoundary() {
        return southBoundary;
    }

    public void setSouthBoundary(String southBoundary) {
        this.southBoundary = southBoundary;
    }

    public String getSouthWestBoundary() {
        return southWestBoundary;
    }

    public void setSouthWestBoundary(String southWestBoundary) {
        this.southWestBoundary = southWestBoundary;
    }

    public String getWestBoundary() {
        return westBoundary;
    }

    public void setWestBoundary(String westBoundary) {
        this.westBoundary = westBoundary;
    }

    public String getNorthWestBoundary() {
        return northWestBoundary;
    }

    public void setNorthWestBoundary(String northWestBoundary) {
        this.northWestBoundary = northWestBoundary;
    }

//    public String getPrefLanguage() {
//        return prefLanguage;
//    }
//
//    public void setPrefLanguage(String prefLanguage) {
//        this.prefLanguage = prefLanguage;
//    }
//
//    public GeoParcelCode getGeoParcelCode() {
//        return geoParcelCode;
//    }
//
//    public void setGeoParcelCode(GeoParcelCode geoParcelCode) {
//        this.geoParcelCode = geoParcelCode;
//    }
//
//    public String getAreaInWord() {
//        return areaInWord;
//    }
//
//    public void setAreaInWord(String areaInWord) {
//        this.areaInWord = areaInWord;
//    }

    public boolean isMigratedRecord() {
        return migratedRecord;
    }

    public void setMigratedRecord(boolean migratedRecord) {
        this.migratedRecord = migratedRecord;
    }

    public District getDistrict() {
        return district;
    }

    public void setDistrict(District district) {
        this.district = district;
    }

    public RailwayTrack getRailwayTrack() {
        return railwayTrack;
    }

    public void setRailwayTrack(RailwayTrack railwayTrack) {
        this.railwayTrack = railwayTrack;
    }

    public DistrictEngineerZone getDistrictEngineerZone() {
        return districtEngineerZone;
    }

    public void setDistrictEngineerZone(DistrictEngineerZone districtEngineerZone) {
        this.districtEngineerZone = districtEngineerZone;
    }

    public IPWZone getIpwZone() {
        return ipwZone;
    }

    public void setIpwZone(IPWZone ipwZone) {
        this.ipwZone = ipwZone;
    }

    public RailwayProtectionZone getRailwayProtectionZone() {
        return railwayProtectionZone;
    }

    public void setRailwayProtectionZone(RailwayProtectionZone railwayProtectionZone) {
        this.railwayProtectionZone = railwayProtectionZone;
    }

    public RailwayStation getNearestRailwayStation() {
        return nearestRailwayStation;
    }

    public void setNearestRailwayStation(RailwayStation nearestRailwayStation) {
        this.nearestRailwayStation = nearestRailwayStation;
    }

    public LandLocation getLandLocation() {
        return landLocation;
    }

    public void setLandLocation(LandLocation landLocation) {
        this.landLocation = landLocation;
    }

    public GNDivision getGnDivision() {
        return gnDivision;
    }

    public void setGnDivision(GNDivision gnDivision) {
        this.gnDivision = gnDivision;
    }

    public long getInitialRecordId() {
        return initialRecordId;
    }

    public void setInitialRecordId(long initialRecordId) {
        this.initialRecordId = initialRecordId;
    }
}
